package controllers

import (
	"dock/models"
	beego "github.com/beego/beego/v2/server/web"
)

type DockController struct {
	beego.Controller
}

func (c *DockController) List() {
	var dock models.Dock
	err := models.DB.Find(&dock).Error
	if err != nil {
		c.Data["json"] = map[string]interface{}{
			"code": 500,
			"msg":  "查询失败",
		}
		c.ServeJSON()
		return
	}
	c.Data["json"] = map[string]interface{}{
		"code": 200,
		"msg":  "查询成功",
		"data": dock,
	}
	c.ServeJSON()
	return
}
